# -*- coding: utf-8 -*-

class EncrptyUtil(object):

    def encrypt(self, password):
        verify = ""
        ls_retrun = ""
        li_len = 0
        li_count = 1
        lc_tmp = ""
        if not password:
            return ""
        else:
            password += verify
            li_len = len(password)
            for li_count in range(1, li_len + 1):
                lc_tmp = unichr(ord(password[li_count-1]) + (((23 * li_count) % li_len) * 3) % 7)
                ls_retrun += lc_tmp
        return ls_retrun

    def decrypt(self, password):
        verify = ""
        ls_retrun = ""
        li_len = 0
        li_count = 1
        lc_tmp = ""
        if not password:
            return ""
        else:
            password += verify
            li_len = len(password)
            for li_count in range(1, li_len + 1):
                lc_tmp = unichr(ord(password[li_count-1]) - (((23 * li_count) % li_len) * 3) % 7)
                ls_retrun += lc_tmp
        return ls_retrun


if __name__ == '__main__':
    print "============"
    print EncrptyUtil().encrypt(u"831<005027!0:;55;99-<26872#9732")
    print "=================="
    ls_str = "831<005027!0:;55;99-<26872#9732"
    print EncrptyUtil().decrypt(unicode(ls_str))

